package com.bigcms.mapper;

import com.bigcms.domain.Art;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
public interface ArtMapper {
    /**
     * 插入
     * @param art
     * @return
     */
    @Insert("INSERT INTO `bc_art` ( `title`, `body`, `create_time`, `update_time`, `uid`, `pid`) VALUES ( #{title}, #{body}, #{createTime}, #{updateTime},#{uid}, #{pid})")
    int add(Art art);

    /**
     * 编辑
     * @param art
     * @return
     */
    int edit(Art art);

    /**
     * 删除
     * @param id
     * @return
     */
    @Delete("DELETE FROM bc_art WHERE id=#{id}")
    int del(int id);

    /**
     * 查询单条
     * @param id
     * @return
     */
    Art find(int id);

    /**
     * 查询多条
     * @return
     */
    List<Art> findall();
}
